import es
import nativetools as nt

def mute(userid, status=0):
    nt.mutePlayer(userid, status)
#def mute(userid, status=0):
#    if list == type(userid):
#        for user in userid:
#            nt.mutePlayer(user, status)
#    else: nt.mutePlayer(userid, status)

def team(userid, team):
    if list == type(userid):
        for user in userid:
            nt.switchTeam(user, team)
    else: nt.switchTeam(userid, team)

def weaponCurrent(userid):
    return nt.weaponCurrent(userid)

def weaponSlot(userid, slot):
    return nt.weaponSlot(userid, int(slot))

def spawn(userid, force):
    if list == type(userid):
        for user in userid:
            nt.spawnPlayer(user, force)
    else: nt.spawnPlayer(userid, force)

def rayTrace(startPosition, endPosition, fraction=-1.0):
    return nt.rayTrace(tuple(startPosition), tuple(endPosition), fraction)

def beam(userids, startLocation, endLocation, delay=0.0, model='materials/sprites/laser.vmt', halo='materials/sprites/halo01.vmt', startFrame=0, frameRate=1, life=10.0, width=10.0, endWidth=10.0, fadeLength=0, amplitude=0.0, r=255, g=255, b=255, a=255, speed=10):
    modelIndex = es.precachemodel(model)
    haloIndex = es.precachemodel(halo)
    nt.tempEntBeamPoints(list(userids), float(delay), list(startLocation), list(endLocation), int(modelIndex), int(haloIndex), int(startFrame), int(frameRate), float(life), float(width), float(endWidth), int(fadeLength), float(amplitude), int(r), int(g), int(b), int(a), int(speed))

def beam2(userids, startLocation, endLocation, delay=0.0, model='materials/sprites/lgtning.vmt', halo='materials/sprites/halo01.vmt', startFrame=0, frameRate=1, life=10.0, width=50.0, endWidth=10.0, fadeLength=0, amplitude=350.0, r=255, g=255, b=255, a=255, speed=10):
    modelIndex = es.precachemodel(model)
    haloIndex = es.precachemodel(halo)
    nt.tempEntBeamPoints(list(userids), float(delay), list(endLocation), list(startLocation), int(modelIndex), int(haloIndex), int(startFrame), int(frameRate), float(life), float(width), float(endWidth), int(fadeLength), float(amplitude), int(r), int(g), int(b), int(a), int(speed))

def beacon(userids, location, delay=0.0, startRadius=10.0, endRadius=256.0, model='materials/sprites/laser.vmt', halo='materials/sprites/halo01.vmt', startFrame=0, frameRate=1, life=2.0, width=15.0, spread=0, amplitude=10, r=255, g=0, b=0, a=255, speed=100, flags=1 << 8):
    modelIndex = es.precachemodel(model)
    haloIndex = es.precachemodel(halo)
    nt.tempEntBeamRingPoint(list(userids), float(delay), list(location), float(startRadius), float(endRadius), int(modelIndex), int(haloIndex), int(startFrame), int(frameRate), float(life), float(width), int(spread), float(amplitude), int(r), int(g), int(b), int(a), int(speed), int(flags))